package com.thread;

class MyThread extends Thread{
	  public int x = 0;

	  public void run(){
	    System.out.println("myThread:" + ++x);
	  }
	}

	class R implements Runnable{
	  private int x = 0;
	  public void run(){
	    System.out.println("Runnable implement:" + ++x);
	  }
	}

public class ThreadImplDemo1 {
	 public static void main(String[] args) throws Exception{
		    
		    for(int i=0;i<20;i++){
		      Thread t = new MyThread();
		      t.start();
		    }
		   // Thread.sleep(10000);//让上面的线程运行完成
		    R r = new R();
		    for(int i=0;i<20;i++){
		      Thread t = new Thread(r);
		      t.start();
		    }
		  }
}
